{% extends 'admin/base.html' %}

{% block title %}
    欢迎来到管理平台！
{% endblock %}

{% block admin_content %}
    <div class="row">
        <div class="col-md-1"></div>
        <div class="col-md-10">
            <div class="panel">
                <div class="panel-heading">
                    <h3><strong><i>&nbsp;{{ current_user.username }}</i>，进行账户修改！</strong></h3>
                </div>
                <div class="panel-body">
                    <div class="entry-box account">
                        <div class="user-info">
                            {#                            <img class="img-rounded profile-thumbnail" src="{{ current_user.gravatar(size=128) }}">#}
                            <img class="img-rounded profile-thumbnail" src="">
                            <div class="profile-header">
                                <div>
                                    <label>昵称：</label>
                                    <span class="username" style="float: none">{{ current_user.username }}</span>
                                </div>
                                <div>
                                    <label>电子邮件：</label>
                                    <span class="email">{{ current_user.email }}</span>
                                </div>
                                <a class="btn btn-sm btn-danger" onclick="changePassword()">
                                    修改密码
                                </a>
                                <a class="btn btn-sm btn-info" onclick="EditUserInfo()">
                                    修改信息
                                </a>
                            </div>
                        </div>
                    </div>

                    <!-- 信息删除确认: For change password form-->
                    <div class="modal fade" id="changePasswordFormModal">
                        <div class="modal-dialog">
                            <div class="modal-content message_align">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                            aria-hidden="true">×</span></button>
                                    <h4 class="modal-title" id="NavModalTitle"></h4>
                                </div>
                                <form id="changePasswordForm" method="post"
                                      action="{{ url_for('others.change_password') }}">
                                    <div class="modal-body">
                                        <div class="form-group">
                                            {{ form.csrf_token }}
                                            {{ form.old_password.label }}
                                            {{ form.old_password(class='form-control', required='') }}
                                            {{ form.password.label }}
                                            {{ form.password(class='form-control', required='') }}
                                            {{ form.password2.label }}
                                            {{ form.password2(class='form-control', required='') }}
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <button id="changePasswordCfmClick" type="submit" class="btn btn-success">确定
                                        </button>
                                    </div>
                                </form>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div><!-- /.modal -->

                    <!-- 信息删除确认: For edit user info form-->
                    <div class="modal fade" id="editUserInfoFormModal">
                        <div class="modal-dialog">
                            <div class="modal-content message_align">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                            aria-hidden="true">×</span></button>
                                    <h4 class="modal-title" id="NavModalTitle"></h4>
                                </div>
                                <form id="editUserInfoForm" method="post"
                                      action="{{ url_for('others.edit_user_info') }}">
                                    <div class="modal-body">
                                        <div class="form-group">
                                            {{ form2.csrf_token }}
                                            {{ form2.username.label }}
                                            {{ form2.username(class='form-control', required='', value=current_user.username) }}
                                            {{ form2.email.label }}
                                            {{ form2.email(class='form-control', required='', value=current_user.email) }}
                                            {{ form2.password.label }}
                                            {{ form2.password(class='form-control', required='') }}
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <button id="editUserInfoCfmClick" type="submit" class="btn btn-success">确定
                                        </button>
                                    </div>
                                </form>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div><!-- /.modal -->
                </div>
            </div>
        </div>
    </div>

{% endblock %}